Skip to content

fix(acp): treat session/prompt ack timeout as delivered#4812

Merged
aegis-gh-agent[bot] merged 1 commit into
developfrom
fix/acp-sendprompt-ack-delivered
Jun 27, 2026
Merged

fix(acp): treat session/prompt ack timeout as delivered#4812
aegis-gh-agent[bot] merged 1 commit into
developfrom
fix/acp-sendprompt-ack-delivered

Conversation

@OneStepAt4time

Copy link
Copy Markdown
Owner

Aegis version

Developed with: v0.6.7

Problem

POST /v1/sessions/:id/send to an idle session returned a false-negative 422 PROMPT_DELIVERY_FAILED (prompt_ack_timeout) even though the prompt was delivered and the agent replied. The dashboard showed an error toast for a message that went through — continue-conversation appeared broken.

Root cause

sendPrompt treated AcpJsonRpcTimeoutError as "not delivered" (#4705). Empirically the request is written to a live JSON-RPC pipe and claude-agent-acp (single-threaded, in-order) processes the queued prompt; the ack merely lags past the 5s window on idle/cold-resumed sessions. A dead pipe rejects with a transport error, never a timeout — so a timeout is a slow ack, not a non-delivery.

Change

Reverses the #4705 assumption: on session/prompt timeout, return delivered: true; the transcript remains the source of truth. Actual JSON-RPC errors (e.g. -32601) are still thrown.

  • src/services/acp/backend/prompts.ts — timeout → { delivered: true, attempts: 1 }.
  • Updated 3 test sites that asserted the old delivered: false / prompt_ack_timeout behavior (acp-sendprompt-timeout-4705.test.ts, acp-backend.test.ts).

Verification

  • npx tsc --noEmit clean.
  • 35/35 ACP tests pass (sendprompt-timeout-4705, acp-backend, handshake-race-4738/4760).
  • Live: /send on an idle session → {"ok":true,"delivered":true,"attempts":1}, reply appears in transcript (was 422).

Notes

POST /v1/sessions/:id/send to an idle session returned a false-negative
422 PROMPT_DELIVERY_FAILED even though the prompt was delivered and the
agent replied — the dashboard surfaced an error toast for a message that
went through.

Root cause: sendPrompt treated an AcpJsonRpcTimeoutError as "not delivered"
(#4705). Empirically the request is written to a live JSON-RPC pipe and
claude-agent-acp (single-threaded, in-order) processes the queued prompt;
the ack merely lags past the 5s window on idle/cold-resumed sessions. A
dead pipe rejects with a transport error, never a timeout — so a timeout
is a slow ack, not a non-delivery.

Reverses the #4705 assumption: timeout now returns delivered:true; the
transcript remains the source of truth. Actual JSON-RPC errors (e.g.
-32601) are still thrown. Updated the 3 test sites that asserted the old
delivered:false / prompt_ack_timeout behavior.

Verified live: /send on an idle session returns
{"ok":true,"delivered":true,"attempts":1} and the reply appears in the
transcript.

Generated by Hephaestus (Aegis dev agent)

@aegis-gh-agent aegis-gh-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved.

Review summary:

  • Correctness: Reverses the #4705 assumption with empirical justification. Timeout on a live JSON-RPC pipe = slow ack, not non-delivery. Dead pipes reject with transport errors, never timeouts. The reasoning is sound.
  • Security: No new attack surface. No secrets, no input validation changes.
  • Tests: 3 test sites updated (acp-backend.test.ts, acp-sendprompt-timeout-4705.test.ts). New direct sendPrompt test covers the continue-conversation case. All assertions match the new behavior.
  • Patterns: Follows existing error handling patterns. Log operation renamed from promptAckTimeoutpromptAckTimeoutAccepted for audit clarity.
  • PR Hygiene: fix(acp): title correct. Targets develop. Issue #4705 linked in body. +53/-18, 3 files — focused scope.
  • CI: 16/17 green, 1 pending (helm-smoke). All critical checks pass (test ubuntu-20/22, lint, dashboard-e2e, platform-smoke, CodeQL, security scans).

9-gate sweep: All gates pass. Squash merging now.

@aegis-gh-agent aegis-gh-agent Bot merged commit 4b28fbd into develop Jun 27, 2026
17 of 18 checks passed
@aegis-gh-agent aegis-gh-agent Bot deleted the fix/acp-sendprompt-ack-delivered branch June 27, 2026 06:16
OneStepAt4time pushed a commit that referenced this pull request Jun 27, 2026
…emantics

PR #4812 reverses the #4705 assumption: a session/prompt timeout is now
treated as delivered:true (slow ack on a live pipe, not non-delivery).
Update the error-values note in the POST /v1/sessions/:id/send section
to reflect the new semantics and clarify when prompt_ack_timeout still
surfaces in the 422 response.

Refs: #4812, #4705
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants